<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:p="http://primefaces.prime.com.tr/ui"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:survey="http://java.sun.com/jsf/composite/components/question"
				template="/layout/template.xhtml">

	<ui:define name="body">
				
		<h:form id="creationForm">
			
			<h:panelGrid columns="1" styleClass="panel-text full-size">
				<p:panel header="Checkbox Question Creation Form">  
			
						<survey:question questionText="#{checkboxQuestionCreationView.newQuestion.text}"
										 questionLevel="#{checkboxQuestionCreationView.newQuestion.level}" />
						
						<h:panelGrid columns="2" style="text-align: left;">
						
							<h:outputLabel for="nullableAnswerCheckbox" value="Allow empty answers? (no option is selected)" />
							<h:selectBooleanCheckbox id="nullableAnswerCheckbox" value="#{checkboxQuestionCreationView.newQuestion.nullableAnswer}" />
							<h:column>
								<h:outputText for="minOptionsText" value="The user must select at least " />
								<h:inputText id="minOptionsText" value="#{checkboxQuestionCreationView.newQuestion.minNumberChosenOptions}" size="3" style="text-align: center;" />
								<h:outputText value="options" />
							</h:column>
						</h:panelGrid>
						
						<survey:inputOptions addAction="#{checkboxQuestionCreationView.addNewOption}"
											 removeAction="#{checkboxQuestionCreationView.removeLastChoice}" />
						
				</p:panel>
				
		        <h:panelGrid columns="2" rowClasses="align-right" styleClass="full-size">
		        	<h:panelGroup>
						<p:commandButton value="Save" action="#{checkboxQuestionCreationView.createQuestion}" update="creationForm, notifications, statisticsPanel:statisticsPanel" />
						<p:commandButton action="home" value="Finish" immediate="true" ajax="false" />
					</h:panelGroup>
				</h:panelGrid>
			
			</h:panelGrid>
			
		</h:form>
	</ui:define>
</ui:composition>